<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 200px;
            height: 200px;
            background-color: pink;
        }
        .active{
            background-color: skyblue;
        }

        .border{
            border: 2px solid orangered;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="box" @click="isActive=!isActive" v-bind:style="{border: '5px solid red','font-size':'20px'}">
            hello 
        </div>

        <!-- 跟对象 -->
        <!-- <div class="box" @click="isActive=!isActive" v-bind:style="isActive?{border: '5px solid red',fontSize:'20px'}:{}"> -->
            <!-- hello  -->
        <!-- </div> -->

        <!-- 静态的情况 -->
        <div class="box" @click="isActive=!isActive" style="border: '5px solid red'; font-size: '20px'">
            hello!
          </div>
    

        <!-- 跟数组 -->
        <div class="box" @click="isActive=!isActive" v-bind:style="[{border: '5px solid red',fontSize:'20px'},styleObj]">
            hello 
        </div>
       
    
    </div>

    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.9/vue.js"></script>

    <script>
        // 表单操作 可以直接利用v-model指令绑定表单项，动态获取用户输入的内容
        var vm = new Vue({
            el: "#app",
            // data里面的this不是vm实例
            data: {
               isActive: false,
               className: {active: true,border:true},
               styleObj: {
                   backgroundColor: "purple"
               }
            },
            methods: {
                

            }
           
        })
    </script>
</body>

</html>